import logging

import pytest

from resource.pom.settings import Settings


class Test:
    app = Settings

    @pytest.mark.parametrize('setup_teardown', [app.bundle_name], indirect=True)
    def test(self, setup_teardown, device):
        logging.info('步骤1.点击设置应用')
        device.start_ability(self.app.bundle_name, self.app.ability_name)
        logging.info('预期结果1.进入设置界面')
        device.assert_current_window(self.app.window_name)

        logging.info('步骤2.点击顶部搜索框')
        device.click(*self.app.search_setting_item)
        device.refresh_layout()
        search_area = device.get_element_by_type('TextInput')
        device.click_element(search_area)
        logging.info('预期结果2.唤醒键盘')
        device.wait(1)
        device.assert_soft_keyboard_on()

        logging.info('步骤3.输入模块名称查找对应模块')
        x, y = device.center_of_element(search_area)
        device.input_text(x, y, 'WLAN')
        logging.info('预期结果3.搜索结果显示的模块为输入的名称对应的模块（目前未实现）')
        pass
